package com.baseEnum;

import java.util.LinkedList;
import java.util.List;

public abstract class SystemEnum {

    private static List<SystemEnum> values = new LinkedList<SystemEnum>();

    public static void register(SystemEnum systemEnum) {
        values.add(systemEnum);
    }

    private String columnName;

    public SystemEnum(String columnName) {
        this.columnName = columnName;
    }

    public static SystemEnum get(String columnName) {
        for (SystemEnum type : SystemEnum.values) {
            if (type.getColumnName().equals(columnName)) {
                return type;
            }
        }
        return null;
    }

    public String getColumnName() {
        return columnName;
    }

    public BaseEnum getDefault() {
        return null;
    }

    public abstract BaseEnum getEnum(int value);

}
